/**
 * Created by Cameron on 2/6/14.
 *
 Diamond
 Given a number n, print a centered diamond. Example for n=3:
   *
  ***
 *****
  ***
   *

    *
   ***
  *****
 ********
  *****
   ***
    *

 */
public class Diamond_Drawer {
    void draw_diamond(int n) {
        // Draw an isosceles triangle first
        for(int i=0; i < n; i++) {
            // print spaces
            for(int j = n-i-1; j>0; j--) {
                System.out.print(" ");
            }
            // print asterixes
            for(int j=0; j < i*2 + 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
        // Now draw a shorter upside down isosceles triangle
        for(int i=0; i<n-1; i++) {
            // print spaces
            for(int j = 0; j < i+1; j++) {
                System.out.print(" ");
            }
            // print asterixes
            for(int j=0; j < ((n-1)-i)*2 - 1; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
        System.out.println();
    }

    public static void main(String[] args) {
        Diamond_Drawer diamond_drawer = new Diamond_Drawer();
        diamond_drawer.draw_diamond(3);
        diamond_drawer.draw_diamond(4);
        diamond_drawer.draw_diamond(0);
    }
}
